// pages/my/my.js
const app = getApp();
const utils = require('../../utils/util.js');
const post = utils.post;
const getCurrentPageUrlWithArgs = utils.getCurrentPageUrlWithArgs;
Page({

  /**
   * 页面的初始数据
   */
  data: {
    m_uid: '',
    list: [],
    weapp_status: 0,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let that = this;

    let p0 = {
      m: 'weapp_status',
      v: 3
    };
    post(p0).then(res => {
      that.setData({
        weapp_status: res.status
      });
    });

    let uid = wx.getStorageSync('z_uid')
    this.setData({
      m_uid: '6'
    });
    if (uid) {
      let p = {
        m: 'new_personal',
        uid: uid
      }
      post(p).then(res => {
        //console.log(res)
        that.setData({
          list: res
        })
      })
    }
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },
  submitFormId(e) {
    let formId = e.detail.formId;
    let button = e.detail.target.dataset.name;
    var m_uid = wx.getStorageSync("m_uid");
    let page = getCurrentPageUrlWithArgs();
    let p = {
      m: 'colform',
      uid: m_uid,
      openid: wx.getStorageSync('weapp_openid'),
      formId: formId,
    }
    if (page && page.length > 0) {
      p.page = page;
    }
    if (button && button.length > 0) {
      p.button = button;
    }
    //console.log(p);
    post(p).then(res => {
    })
  }
})